package keter.domain.validation;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

import keter.domain.Account;

/**
 * Validates the InvoiceItem class.
 * 
 * @author Jerzy
 */
public class PasswordValidator implements ConstraintValidator<PasswordConstraint, Account> {

	@Override
	public void initialize(PasswordConstraint arg0) {
		// empty
	}

	@Override
	public boolean isValid(Account user, ConstraintValidatorContext context) {
		if(user.getRepeatPassword()==null){
			return false;
		}
		return user.getPassword().equals(user.getRepeatPassword());
	}

}
